import {Injectable}     from 'angular2/core';
import {Http, Response} from 'angular2/http';
import {Headers, RequestOptions} from 'angular2/http';

/**
 * activty service
 */
@Injectable()
export class ActivityService {
  private _activityUrl = "http://apis.baidu.com/apistore/stockservice/hkstock?stockid=00168&list=1";
  
  constructor(private http: Http) {
  }
  
  getActivity () {
    let headers = new Headers({ 'apikey': '088a911ed7495ff7cdc93a370857a9b0' });
    let options = new RequestOptions({ headers: headers });
    this.http.get(this._activityUrl, options)
            .map(res => res.json())
            .subscribe((res)=>{
              console.log(res);
            }, (error)=>{
              console.log(error);
            });
  }
}